package com.hzhr.iot.device.service;

import com.hzhr.iot.core.annotation.ApiImplicitInternalParams;
import com.hzhr.iot.core.annotation.CygQuery;
import com.hzhr.iot.core.annotation.CygQuerys;
import com.hzhr.iot.core.annotation.CygService;
import com.hzhr.iot.core.constant.AccessModeEnum;
import com.hzhr.iot.core.constant.CommonOptions;
import com.hzhr.iot.core.exception.ServiceException;
import com.hzhr.iot.core.util.HzhrTypeUtil;
import com.hzhr.iot.device.constant.DeviceOptions;
import com.hzhr.iot.device.convertor.custom.CollectDeviceCustomConvertor;
import com.hzhr.iot.device.dao.CollectDeviceDao;
import com.hzhr.iot.device.dao.IotDeviceDao;
import com.hzhr.iot.device.dao.helper.CollectDeviceDaoHelper;
import com.hzhr.iot.device.dao.helper.IotDeviceDaoHelper;
import com.hzhr.iot.device.entity.CollectDeviceEntity;
import com.hzhr.iot.device.entity.ext.CollectDeviceEntityExt;
import com.hzhr.iot.device.model.collectDevice.CollectDeviceGetModel;
import com.hzhr.iot.device.model.collectDevice.CollectDeviceModel;
import com.hzhr.iot.device.queryModel.custom.CollectDeviceCustomQueryModel;
import com.hzhr.iot.device.service.base.BaseService;
import com.hzhr.iot.device.service.helper.*;
import com.hzhr.iot.login.sdk.model.userCard.UserCardModel;
import com.hzhr.iot.toll.sdk.service.Toll_GasUserService;
import com.hzhr.iot.user.sdk.model.company.CompanyModel;
import com.hzhr.iot.user.sdk.model.dept.DeptModel;
import com.hzhr.iot.user.sdk.service.User_CompanyService;
import com.hzhr.iot.user.sdk.service.User_DeptService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.*;

@Service
@CygService(entity = CollectDeviceEntity.class, model = CollectDeviceModel.class)
@CygQuerys({
        @CygQuery(name = "_equal_id", query = "equal_id", type = Integer.class),
        @CygQuery(name = "_equal_code", query = "equal_code", type = String.class),
        @CygQuery(name = "_equal_companyId", query = "equal_companyId", type = Integer.class),
        @CygQuery(name = "_equal_deptId", query = "equal_deptId", type = Integer.class),
        @CygQuery(name = "_equal_deptCode", query = "equal_deptCode", type = String.class),
        @CygQuery(name = "_equal_categoryCode", query = "equal_categoryCode", type = String.class),
        @CygQuery(name = "_like_code", query = "like_code", type = String.class),
        @CygQuery(name = "_equal_iotDeviceId", query = "equal_iotDeviceId", type = Integer.class),
        @CygQuery(name = "_like_iotDeviceCode", query = "like_iotDeviceExt_code", type = String.class),
        @CygQuery(name = "_like_gasUserName", query = "like_gasUserName", type = String.class),
        @CygQuery(name = "_like_gasUserCode", query = "like_gasUserCode", type = String.class),
        @CygQuery(name = "_like_gasUserAddress", query = "like_gasUserAddress", type = String.class),
        @CygQuery(name = "_greaterthanorequal_createTime", query = "greaterthanorequal_createTime", type = Date.class),
        @CygQuery(name = "_lessthan_createTime", query = "lessthan_createTime", type = Date.class),
        @CygQuery(name = "_equal_gasUserId", query = "equal_gasUserId", type = Integer.class),
        @CygQuery(name = "_equal_prodFactoryId", query = "equal_typeExt_prodFactoryId", type = Integer.class),
        @CygQuery(name = "_equal_iotDeviceCompanyName", query = "equal_iotDeviceExt_companyExt_name", type = String.class),
        @CygQuery(name = "_equal_gasUserCode", query = "equal_gasUserCode", type = String.class),
        @CygQuery(name = "_like_deptCode", query = "like_deptCode", type = String.class),
        @CygQuery(name = "_equal_iotDeviceCompanyId", query = "equal_iotDeviceExt_companyId", type = Integer.class),
        @CygQuery(name = "_equal_prodFactoryIotCompanyId", query = "equal_typeExt_prodFactoryExt_iotCompanyId", type = Integer.class),

})
public class CollectDeviceService extends BaseService {
    @Autowired
    CollectDeviceCustomConvertor collectDeviceCustomConvertor;
    @Autowired
    CollectDeviceDao collectDeviceDao;
    @Autowired
    CollectDeviceService collectDeviceService;
    @Autowired
    User_DeptService user_deptService;
    @Autowired
    Toll_GasUserService toll_gasUserService;
    @Autowired
    IotDeviceService iotDeviceService;
    @Autowired
    User_CompanyService user_companyService;
    @Autowired
    CollectDataService collectDataService;
    @Autowired
    IotDeviceDao iotDeviceDao;
    @Autowired
    DeviceOptions deviceOptions;
    @Autowired
    IotDeviceTypeServiceHelper iotDeviceTypeServiceHelper;
    @Autowired
    IotDeviceServiceHelper iotDeviceServiceHelper;
    @Autowired
    CollectDeviceServiceHelper collectDeviceServiceHelper;
    @Autowired
    User_DeptServiceHelper user_deptServiceHelper;
    @Autowired
    Toll_GasUserServiceHelper toll_gasUserServiceHelper;
    @Autowired
    IotDeviceDaoHelper iotDeviceDaoHelper;
    @Autowired
    CollectDeviceDaoHelper collectDeviceDaoHelper;
    @Autowired
    User_CompanyServiceHelper user_companyServiceHelper;

    //region javadoc注释 : get
    /**
     * 查询用户管辖范围下的采集设备 <br/><br/>
     * 简介 : 查询用户管辖范围下的采集设备 <br/>
     * 步骤 : <br/>
     * 1. 查询用户管辖范围下的采集设备 <br/>
     * 2. 返回信息 <br/>
     * @param header <br/>
     * _token : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 令牌;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-user-id : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 用户编号;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _hzhr-user-code : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 用户代码;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-user-name : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 用户名;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-company-id : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 公司编号;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _hzhr-dept-id : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 部门编号;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _hzhr-user-type : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 用户类型(关联: common_service.options.code, typeCode = 'USER_TYPE');<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-transaction-id : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 交易流水号;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-transaction-type : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 交易类型;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-access-mode : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 访问模式 0:一般 1:全局;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : 0;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/><br/>
     * @param query <br/>
     * _show : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 展示形式 one:展示一个,list:展示列表,null(空值):不展示;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _show_total : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 是否展示总数;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : boolean;<br/>
     * _show_info : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 是否展示详情;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : boolean;<br/>
     * _show_type : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 是否设备型号信息;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : boolean;<br/>
     * _show_iotDevice : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 是否所属物联网设备信息;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : boolean;<br/>
     * _show_gasUser : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 是否所属燃气用户信息;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : boolean;<br/>
     * _show_gasConsume : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 是否展示总用气量;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : boolean;<br/>
     * _show_alarmCount : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 是否展示总报警数;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : boolean;<br/>
     * _show_dept : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 是否展示部门信息;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : boolean;<br/>
     * _show_outId : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 是否展示外部系统唯一键;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : boolean;<br/>
     * _is_paging : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 是否分页;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : boolean;<br/>
     * _page : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 页数;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : 1;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _count : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 每页数量;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : 1;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _equal_id : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where COLLECT_DEVICE.ID = #{_equal_id};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _equal_code : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where COLLECT_DEVICE.CODE = #{_equal_code};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _equal_companyId : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where COLLECT_DEVICE.COMPANY_ID = #{_equal_companyId};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _equal_deptId : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where COLLECT_DEVICE.DEPT_ID = #{_equal_deptId};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _equal_deptCode : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where COLLECT_DEVICE.DEPT_CODE = #{_equal_deptCode};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _equal_categoryCode : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where COLLECT_DEVICE.CATEGORY_CODE = #{_equal_categoryCode};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _like_code : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where COLLECT_DEVICE.CODE like #{_like_code};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _equal_iotDeviceId : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where COLLECT_DEVICE.IOT_DEVICE_ID = #{_equal_iotDeviceId};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _like_iotDeviceCode : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where COLLECT_DEVICE.IOT_DEVICE(关联键：IOT_DEVICE_ID).CODE like #{_like_iotDeviceCode};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _like_gasUserName : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where COLLECT_DEVICE.GAS_USER_NAME like #{_like_gasUserName};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _like_gasUserCode : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where COLLECT_DEVICE.GAS_USER_CODE like #{_like_gasUserCode};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _like_gasUserAddress : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where COLLECT_DEVICE.GAS_USER_ADDRESS like #{_like_gasUserAddress};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _greaterthanorequal_createTime : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where COLLECT_DEVICE.CREATE_TIME >= #{_greaterthanorequal_createTime};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : long;<br/>
     * _lessthan_createTime : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where COLLECT_DEVICE.CREATE_TIME < #{_lessthan_createTime};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : long;<br/>
     * _equal_gasUserId : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where COLLECT_DEVICE.GAS_USER_ID = #{_equal_gasUserId};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : long;<br/>
     * _equal_prodFactoryId : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where COLLECT_DEVICE.COLLECT_DEVICE_TYPE(关联键：TYPE_ID).PROD_FACTORY_ID = #{_equal_prodFactoryId};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _equal_iotDeviceCompanyName : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where COLLECT_DEVICE.IOT_DEVICE(关联键：IOT_DEVICE_ID).USER_COMPANY(关联键：COMPANY_ID).NAME = #{equal_iotDeviceCompanyName};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _equal_gasUserCode : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where COLLECT_DEVICE.GAS_USER_CODE = #{_equal_gasUserCode};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _like_deptCode : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where COLLECT_DEVICE.DEPT_CODE like #{_like_deptCode};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _equal_iotDeviceCompanyId : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where COLLECT_DEVICE.IOT_DEVICE(关联键：IOT_DEVICE_ID).COMPANY_ID = #{_equal_iotDeviceCompanyId};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _equal_prodFactoryIotCompanyId : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where COLLECT_DEVICE.COLLECT_DEVICE_TYPE(关联键：TYPE_ID).PROD_FOCTORY(关联键：PROD_FOCTORY_ID).IOT_COMPANY_ID = #{_equal_prodFactoryIotCompanyId};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/><br/>
     * @throws ServiceException <br/>
     * @see CollectDeviceGetModel result <br/>
     */ 
    //endregion
    //region 说明 : get
    //查询用户管辖范围下的采集设备
    //简介 : 查询用户管辖范围下的采集设备
    //步骤 :
    //1. 查询用户管辖范围下的采集设备
    //2. 返回信息
    //endregion
    //region 参数 : get
    @ApiImplicitParams({
            @ApiImplicitParam(name = "token", value = "令牌",required = true, dataType = "string", paramType = "header"),

            @ApiImplicitParam(name = "show", value = "展示形式 one:展示一个,list:展示列表,null(空值):不展示", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "show_total", value = "是否展示总数", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "show_info", value = "是否展示详情", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "show_type", value = "是否展示设备型号信息", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "show_iotDevice", value = "是否展示所属物联网设备信息", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "show_gasUser", value = "是否展示所属燃气用户信息", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "show_gasConsume", value = "是否展示总用气量", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "show_alarmCount", value = "是否展示总报警数", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "show_dept", value = "是否展示部门信息", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "show_outId", value = "是否展示外部系统唯一键", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "page", value = "页数", defaultValue = "1",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "count", value = "每页数量", defaultValue = "1",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "equal_id", value = "筛选条件 : where CollectDeviceModel.id = #{equal_id}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "equal_code", value = "筛选条件 : where CollectDeviceModel.code = #{equal_code}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "equal_companyId", value = "筛选条件 : where CollectDeviceModel.companyId = #{equal_companyId}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "equal_deptId", value = "筛选条件 : where CollectDeviceModel.deptId = #{equal_deptId}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "equal_deptCode", value = "筛选条件 : where CollectDeviceModel.deptCode = #{equal_deptCode}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "equal_categoryCode", value = "筛选条件 : where CollectDeviceModel.categoryCode = #{equal_categoryCode}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "like_code", value = "筛选条件 : where CollectDeviceModel.code like #{like_code}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "equal_iotDeviceId", value = "筛选条件 : where CollectDeviceModel.iotDeviceId = #{equal_iotDeviceId}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "like_iotDeviceCode", value = "筛选条件 : where CollectDeviceModel.iotDeviceCode like #{like_iotDeviceCode}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "like_gasUserName", value = "筛选条件 : where CollectDeviceModel.gasUserName like #{like_gasUserName}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "like_gasUserCode", value = "筛选条件 : where CollectDeviceModel.gasUserCode like #{like_gasUserCode}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "like_gasUserAddress", value = "筛选条件 : where CollectDeviceModel.gasUserAddress like #{like_gasUserAddress}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "greaterthanorequal_createTime", value = "筛选条件 : where CollectDeviceModel.createTime >= #{greaterthanorequal_createTime}",required = false, dataType = "long", paramType = "query"),
            @ApiImplicitParam(name = "lessthan_createTime", value = "筛选条件 : where CollectDeviceModel.createTime < #{lessthan_createTime}",required = false, dataType = "long", paramType = "query"),
            @ApiImplicitParam(name = "equal_gasUserId", value = "筛选条件 : where CollectDeviceModel.gasUserId = #{equal_gasUserId}",required = false, dataType = "long", paramType = "query"),
            @ApiImplicitParam(name = "equal_prodFactoryId", value = "筛选条件 : where CollectDeviceModel.prodFactoryId = #{equal_prodFactoryId}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "equal_iotDeviceCompanyName", value = "筛选条件 : where CollectDeviceModel.iotDeviceCompanyName = #{equal_iotDeviceCompanyName}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "equal_gasUserCode", value = "筛选条件 : where CollectDeviceModel.gasUserCode = #{equal_gasUserCode}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "like_deptCode", value = "筛选条件 : where CollectDeviceModel.deptCode like #{like_deptCode}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "equal_iotDeviceCompanyId", value = "筛选条件 : where CollectDeviceModel.iotDeviceCompanyId = #{equal_iotDeviceCompanyId}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "equal_iotDeviceCompanyId", value = "筛选条件 : where CollectDeviceModel.iotDeviceCompanyId = #{equal_iotDeviceCompanyId}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "equal_prodFactoryIotCompanyId", value = "筛选条件 : where CollectDeviceModel.prodFactoryIotCompanyId = #{equal_prodFactoryIotCompanyId}",required = false, dataType = "int", paramType = "query"),

    })
    @ApiImplicitInternalParams({
            @ApiImplicitParam(name = "_token", value = "令牌",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-id", value = "用户编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-code", value = "用户代码",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-name", value = "用户名",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-company-id", value = "公司编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-dept-id", value = "部门编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-type", value = "用户类型(关联: common_service.options.code, typeCode = 'USER_TYPE')",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-transaction-id", value = "交易流水号",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-transaction-type", value = "交易类型",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-access-mode", value = "访问模式 0:一般 1:全局",defaultValue = "0", required = false, dataType = "int", paramType = "header"),

            @ApiImplicitParam(name = "_show", value = "展示形式 one:展示一个,list:展示列表,null(空值):不展示", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "_show_total", value = "是否展示总数", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "_show_info", value = "是否展示详情", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "_show_type", value = "是否设备型号信息", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "_show_iotDevice", value = "是否所属物联网设备信息", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "_show_gasUser", value = "是否所属燃气用户信息", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "_show_gasConsume", value = "是否展示总用气量", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "_show_alarmCount", value = "是否展示总报警数", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "_show_dept", value = "是否展示部门信息", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "_show_outId", value = "是否展示外部系统唯一键", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "_is_paging", value = "是否分页", defaultValue = "true",required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "_page", value = "页数", defaultValue = "1",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "_count", value = "每页数量", defaultValue = "1",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "_equal_id", value = "筛选条件 : where COLLECT_DEVICE.ID = #{_equal_id}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "_equal_code", value = "筛选条件 : where COLLECT_DEVICE.CODE = #{_equal_code}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "_equal_companyId", value = "筛选条件 : where COLLECT_DEVICE.COMPANY_ID = #{_equal_companyId}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "_equal_deptId", value = "筛选条件 : where COLLECT_DEVICE.DEPT_ID = #{_equal_deptId}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "_equal_deptCode", value = "筛选条件 : where COLLECT_DEVICE.DEPT_CODE = #{_equal_deptCode}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "_equal_categoryCode", value = "筛选条件 : where COLLECT_DEVICE.CATEGORY_CODE = #{_equal_categoryCode}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "_like_code", value = "筛选条件 : where COLLECT_DEVICE.CODE like #{_like_code}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "_equal_iotDeviceId", value = "筛选条件 : where COLLECT_DEVICE.IOT_DEVICE_ID = #{_equal_iotDeviceId}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "_like_iotDeviceCode", value = "筛选条件 : where COLLECT_DEVICE.IOT_DEVICE(关联键：IOT_DEVICE_ID).CODE like #{_like_iotDeviceCode}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "_like_gasUserName", value = "筛选条件 : where COLLECT_DEVICE.GAS_USER_NAME like #{_like_gasUserName}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "_like_gasUserCode", value = "筛选条件 : where COLLECT_DEVICE.GAS_USER_CODE like #{_like_gasUserCode}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "_like_gasUserAddress", value = "筛选条件 : where COLLECT_DEVICE.GAS_USER_ADDRESS like #{_like_gasUserAddress}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "_greaterthanorequal_createTime", value = "筛选条件 : where COLLECT_DEVICE.CREATE_TIME >= #{_greaterthanorequal_createTime}",required = false, dataType = "long", paramType = "query"),
            @ApiImplicitParam(name = "_lessthan_createTime", value = "筛选条件 : where COLLECT_DEVICE.CREATE_TIME < #{_lessthan_createTime}",required = false, dataType = "long", paramType = "query"),
            @ApiImplicitParam(name = "_equal_gasUserId", value = "筛选条件 : where COLLECT_DEVICE.GAS_USER_ID = #{_equal_gasUserId}",required = false, dataType = "long", paramType = "query"),
            @ApiImplicitParam(name = "_equal_prodFactoryId", value = "筛选条件 : where COLLECT_DEVICE.COLLECT_DEVICE_TYPE(关联键：TYPE_ID).PROD_FACTORY_ID = #{_equal_prodFactoryId}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "_equal_iotDeviceCompanyName", value = "筛选条件 : where COLLECT_DEVICE.IOT_DEVICE(关联键：IOT_DEVICE_ID).USER_COMPANY(关联键：COMPANY_ID).NAME = #{equal_iotDeviceCompanyName}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "_equal_gasUserCode", value = "筛选条件 : where COLLECT_DEVICE.GAS_USER_CODE = #{_equal_gasUserCode}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "_like_deptCode", value = "筛选条件 : where COLLECT_DEVICE.DEPT_CODE like #{_like_deptCode}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "_equal_iotDeviceCompanyId", value = "筛选条件 : where COLLECT_DEVICE.IOT_DEVICE(关联键：IOT_DEVICE_ID).COMPANY_ID = #{_equal_iotDeviceCompanyId}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "_equal_prodFactoryIotCompanyId", value = "筛选条件 : where COLLECT_DEVICE.COLLECT_DEVICE_TYPE(关联键：TYPE_ID).PROD_FOCTORY(关联键：PROD_FOCTORY_ID).IOT_COMPANY_ID = #{_equal_prodFactoryIotCompanyId}",required = false, dataType = "int", paramType = "query"),

    })
    //endregion
    //region 请求 : get
    @RequestMapping(value = "/collect-devices", method = RequestMethod.GET)
    //endregion
    public CollectDeviceGetModel get(Map<String, String> header, Map<String, Object> query) throws ServiceException {
        //查询用户管辖范围下的采集设备
        CollectDeviceCustomQueryModel queryModel = collectDeviceCustomConvertor.collectDeviceService_query2queryModel(query);
        Boolean showGasConsume = HzhrTypeUtil.object2boolean(query.get("_show_gasConsume"));
        if (showGasConsume != null && showGasConsume) {
            queryModel.setShow_gasConsume(true);
        }
        UserCardModel userCard = getUserCard(header);
        Integer companyId = userCard.getCompanyId();
        if (companyId != 0) {
            CompanyModel company_1 = user_companyServiceHelper.getById(initHeader(header, AccessModeEnum.GLOBAL), companyId);
            if (company_1.getType().equals("2")) {
                queryModel.setEqual_iotDeviceExt_companyId(userCard.getCompanyId());
            } else if (company_1.getType().equals("1")) {
                queryModel.setLike_resourceCode(userCard.getUserCode() + "%");
            }
        }
        queryModel.setEqual_isValid(CommonOptions.YES_NO.YES);
        //查询实体
        List<CollectDeviceEntityExt> extList = null;
        String show = HzhrTypeUtil.object2string(query.get("_show"));
        if (!StringUtils.isEmpty(show)) {
            extList = collectDeviceDao.selectExtList1(queryModel);
        }
        //查询数量
        Integer total = null;
        Boolean showTotal = HzhrTypeUtil.object2boolean(query.get("_show_total"));
        if (showTotal != null && showTotal) {
            total = collectDeviceDao.selectCount(queryModel);
        }

        //返回信息
        CollectDeviceGetModel result = collectDeviceCustomConvertor.extList2collectDeviceGetModel(extList, total, null, query);
        //查询部门相关信息
        Boolean showDept = HzhrTypeUtil.object2boolean(query.get("_show_dept"));
        List<DeptModel> deptModels = null;
        if (showDept != null && showDept && extList != null) {
            List<Integer> deptIds = new ArrayList<>();
            for (CollectDeviceEntityExt ext : extList) {
                deptIds.add(ext.getDeptId());
            }

            if (deptIds.size() > 0) {
                Map<String, Object> query1 = new HashMap<>();
                query1.put("_in_id", deptIds);
                query1.put("_show", "list");
                query1.put("_show_managementName", true);
                query1.put("_show_subCompanyName", true);
                query1.put("_is_paging", false);
                deptModels = user_deptService.get(initHeader(header, AccessModeEnum.GLOBAL), query1).getModelList();
            }
        }
        //在响应中添加额外信息
        List<CollectDeviceModel> collectDeviceModels = result.getModelList();
        if (collectDeviceModels != null) {
            for (int i = 0; i < collectDeviceModels.size(); i++) {
                CollectDeviceModel collectDeviceModel = collectDeviceModels.get(i);
                if (deptModels != null) {
                    for (DeptModel deptModel :
                            deptModels) {
                        if (collectDeviceModel.getDeptId().equals(deptModel.getId())) {
                            collectDeviceModel.setManagementName(deptModel.getManagementName());
                            collectDeviceModel.setSubCompanyName(deptModel.getSubCompanyName());
                        }
                    }
                }
            }
        }
        CollectDeviceModel collectDeviceModel = result.getModel();
        if (collectDeviceModel != null) {
            if (deptModels != null && deptModels.size() > 0) {
                DeptModel deptModel = deptModels.get(0);
                collectDeviceModel.setManagementName(deptModel.getManagementName());
                collectDeviceModel.setSubCompanyName(deptModel.getSubCompanyName());
            }
        }
        return result;
    }

    //region javadoc注释 : get2
    /**
     * 查询采集设备 <br/><br/>
     * 简介 : 查询采集设备 <br/>
     * 步骤 : <br/>
     * 1. 查询采集设备 : (√) <br/>
     * 根据条件参数查询采集设备(COLLECT_DEVICE)对象collectDevice_1； <br/>
     * collectDevice_1.gasConsume属性说明： <br/>
     *           对应于collectDevice_1所关联的第一个采集数据(COLLECT_DATA)对象(关联方式：COLLECT_DEVICE.ID = COLLECT_DATA.COLLECT_DEVICE_ID)的currentValue属性； <br/>
     * collectDevice_1.gasConsume属性说明： <br/>
     *           对应于collectDevice_1所关联的报警数据(ALARM_DATA)对象(关联方式：COLLECT_DEVICE.ID = COLLECT_DATA.COLLECT_DEVICE_ID)集合的数量； <br/>
     * 2. 返回信息 : (√) <br/>
     * 根据条件参数和查询到结果组装结果对象并返回， <br/>
     * CollectDeviceGetModel中CollectDeviceModel的managementName属性说明： <br/>
     *           对应于CollectDeviceModel模型所关联的user_service.DeptModel模型(关联方式：CollectDeviceModel.deptId = user_service.DeptModel)的managementName属性； <br/>
     * CollectDeviceGetModel模型中CollectDeviceModel模型的subCompanyName属性说明： <br/>
     *           对应于CollectDeviceModel模型所关联的user_service.DeptModel模型(关联方式：CollectDeviceModel.deptId = user_service.DeptModel)的subCompanyName属性； <br/>
     * @param header <br/>
     * _token : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 令牌;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-user-id : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 用户编号;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _hzhr-user-code : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 用户代码;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-user-name : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 用户名;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-company-id : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 公司编号;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _hzhr-dept-id : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 部门编号;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _hzhr-user-type : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 用户类型(关联: common_service.options.code, typeCode = 'USER_TYPE');<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-transaction-id : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 交易流水号;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-transaction-type : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 交易类型;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-access-mode : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 访问模式 0:一般 1:全局;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : 0;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/><br/>
     * @param query <br/>
     * _show : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 展示形式 one:展示一个,list:展示列表,null(空值):不展示;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _show_total : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 是否展示总数;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : boolean;<br/>
     * _show_info : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 是否展示详情;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : boolean;<br/>
     * _show_type : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 是否展示设备型号信息;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : boolean;<br/>
     * _show_iotDevice : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 是否展示所属物联网设备信息;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : boolean;<br/>
     * _show_gasUser : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 是否展示所属燃气用户信息;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : boolean;<br/>
     * _show_gasConsume : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 是否展示总用气量;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : boolean;<br/>
     * _show_alarmCount : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 是否展示总报警数;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : boolean;<br/>
     * _show_dept : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 是否展示部门信息;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : boolean;<br/>
     * _is_paging : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 是否分页;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : boolean;<br/>
     * _page : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 页数;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : 1;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _count : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 每页数量;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : 1;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _equal_id : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where CollectDeviceModel.id = #{_equal_id};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _equal_code : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where CollectDeviceModel.code = #{_equal_code};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _equal_companyId : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where CollectDeviceModel.companyId = #{_equal_companyId};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _equal_deptId : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where CollectDeviceModel.deptId = #{_equal_deptId};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _equal_deptCode : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where CollectDeviceModel.deptCode = #{_equal_deptCode};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _equal_categoryCode : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where CollectDeviceModel.categoryCode = #{_equal_categoryCode};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _like_code : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where CollectDeviceModel.code like #{_like_code};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _equal_iotDeviceId : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where CollectDeviceModel.iotDeviceId = #{_equal_iotDeviceId};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _like_iotDeviceCode : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where CollectDeviceModel.iotDeviceCode like #{_like_iotDeviceCode};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _like_gasUserName : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where CollectDeviceModel.gasUserName like #{_like_gasUserName};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _like_gasUserCode : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where CollectDeviceModel.gasUserCode like #{_like_gasUserCode};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _like_gasUserAddress : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where CollectDeviceModel.gasUserAddress like #{_like_gasUserAddress};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _greaterthanorequal_createTime : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where CollectDeviceModel.createTime >= #{_greaterthanorequal_createTime};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : long;<br/>
     * _lessthan_createTime : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where CollectDeviceModel.createTime < #{_lessthan_createTime};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : long;<br/>
     * _equal_gasUserId : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where CollectDeviceModel.gasUserId = #{_equal_gasUserId};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : long;<br/>
     * _equal_gasUserCode : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where CollectDeviceModel.gasUserCode = #{_equal_gasUserCode};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/><br/>
     * @throws ServiceException <br/>
     * @see CollectDeviceGetModel result <br/>
     */ 
    //endregion
    //region 说明 : get2
    //查询采集设备
    //简介 : 查询采集设备
    //步骤 :
    //1. 查询采集设备 : (√)
    //根据条件参数查询采集设备(COLLECT_DEVICE)对象collectDevice_1；
    //collectDevice_1.gasConsume属性说明：
    //          对应于collectDevice_1所关联的第一个采集数据(COLLECT_DATA)对象(关联方式：COLLECT_DEVICE.ID = COLLECT_DATA.COLLECT_DEVICE_ID)的currentValue属性；
    //collectDevice_1.gasConsume属性说明：
    //          对应于collectDevice_1所关联的报警数据(ALARM_DATA)对象(关联方式：COLLECT_DEVICE.ID = COLLECT_DATA.COLLECT_DEVICE_ID)集合的数量；
    //2. 返回信息 : (√)
    //根据条件参数和查询到结果组装结果对象并返回，
    //CollectDeviceGetModel中CollectDeviceModel的managementName属性说明：
    //          对应于CollectDeviceModel模型所关联的user_service.DeptModel模型(关联方式：CollectDeviceModel.deptId = user_service.DeptModel)的managementName属性；
    //CollectDeviceGetModel模型中CollectDeviceModel模型的subCompanyName属性说明：
    //          对应于CollectDeviceModel模型所关联的user_service.DeptModel模型(关联方式：CollectDeviceModel.deptId = user_service.DeptModel)的subCompanyName属性；
    //endregion
    //region 参数 : get2
    @ApiImplicitParams({
            @ApiImplicitParam(name = "token", value = "令牌",required = true, dataType = "string", paramType = "header"),

            @ApiImplicitParam(name = "show", value = "展示形式 one:展示一个,list:展示列表,null(空值):不展示", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "show_total", value = "是否展示总数", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "show_info", value = "是否展示详情", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "show_type", value = "是否展示设备型号信息", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "show_iotDevice", value = "是否展示所属物联网设备信息", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "show_gasUser", value = "是否展示所属燃气用户信息", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "show_gasConsume", value = "是否展示总用气量", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "show_alarmCount", value = "是否展示总报警数", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "show_dept", value = "是否展示部门信息", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),            @ApiImplicitParam(name = "page", value = "页数", defaultValue = "1",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "count", value = "每页数量", defaultValue = "1",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "equal_id", value = "筛选条件 : where CollectDeviceModel.id = #{equal_id}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "equal_code", value = "筛选条件 : where CollectDeviceModel.code = #{equal_code}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "equal_companyId", value = "筛选条件 : where CollectDeviceModel.companyId = #{equal_companyId}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "equal_deptId", value = "筛选条件 : where CollectDeviceModel.deptId = #{equal_deptId}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "equal_deptCode", value = "筛选条件 : where CollectDeviceModel.deptCode = #{equal_deptCode}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "equal_categoryCode", value = "筛选条件 : where CollectDeviceModel.categoryCode = #{equal_categoryCode}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "like_code", value = "筛选条件 : where CollectDeviceModel.code like #{like_code}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "equal_iotDeviceId", value = "筛选条件 : where CollectDeviceModel.iotDeviceId = #{equal_iotDeviceId}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "like_iotDeviceCode", value = "筛选条件 : where CollectDeviceModel.iotDeviceCode like #{like_iotDeviceCode}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "like_gasUserName", value = "筛选条件 : where CollectDeviceModel.gasUserName like #{like_gasUserName}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "like_gasUserCode", value = "筛选条件 : where CollectDeviceModel.gasUserCode like #{like_gasUserCode}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "like_gasUserAddress", value = "筛选条件 : where CollectDeviceModel.gasUserAddress like #{like_gasUserAddress}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "greaterthanorequal_createTime", value = "筛选条件 : where CollectDeviceModel.createTime >= #{greaterthanorequal_createTime}",required = false, dataType = "long", paramType = "query"),
            @ApiImplicitParam(name = "lessthan_createTime", value = "筛选条件 : where CollectDeviceModel.createTime < #{lessthan_createTime}",required = false, dataType = "long", paramType = "query"),
            @ApiImplicitParam(name = "equal_gasUserId", value = "筛选条件 : where CollectDeviceModel.gasUserId = #{equal_gasUserId}",required = false, dataType = "long", paramType = "query"),
            @ApiImplicitParam(name = "equal_gasUserCode", value = "筛选条件 : where CollectDeviceModel.gasUserCode = #{equal_gasUserCode}",required = false, dataType = "string", paramType = "query"),

    })
    @ApiImplicitInternalParams({
            @ApiImplicitParam(name = "_token", value = "令牌",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-id", value = "用户编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-code", value = "用户代码",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-name", value = "用户名",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-company-id", value = "公司编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-dept-id", value = "部门编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-type", value = "用户类型(关联: common_service.options.code, typeCode = 'USER_TYPE')",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-transaction-id", value = "交易流水号",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-transaction-type", value = "交易类型",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-access-mode", value = "访问模式 0:一般 1:全局",defaultValue = "0", required = false, dataType = "int", paramType = "header"),

            @ApiImplicitParam(name = "_show", value = "展示形式 one:展示一个,list:展示列表,null(空值):不展示", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "_show_total", value = "是否展示总数", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "_show_info", value = "是否展示详情", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "_show_type", value = "是否展示设备型号信息", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "_show_iotDevice", value = "是否展示所属物联网设备信息", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "_show_gasUser", value = "是否展示所属燃气用户信息", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "_show_gasConsume", value = "是否展示总用气量", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "_show_alarmCount", value = "是否展示总报警数", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "_show_dept", value = "是否展示部门信息", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),            @ApiImplicitParam(name = "_is_paging", value = "是否分页", defaultValue = "false",required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "_page", value = "页数", defaultValue = "1",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "_count", value = "每页数量", defaultValue = "1",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "_equal_id", value = "筛选条件 : where CollectDeviceModel.id = #{_equal_id}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "_equal_code", value = "筛选条件 : where CollectDeviceModel.code = #{_equal_code}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "_equal_companyId", value = "筛选条件 : where CollectDeviceModel.companyId = #{_equal_companyId}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "_equal_deptId", value = "筛选条件 : where CollectDeviceModel.deptId = #{_equal_deptId}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "_equal_deptCode", value = "筛选条件 : where CollectDeviceModel.deptCode = #{_equal_deptCode}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "_equal_categoryCode", value = "筛选条件 : where CollectDeviceModel.categoryCode = #{_equal_categoryCode}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "_like_code", value = "筛选条件 : where CollectDeviceModel.code like #{_like_code}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "_equal_iotDeviceId", value = "筛选条件 : where CollectDeviceModel.iotDeviceId = #{_equal_iotDeviceId}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "_like_iotDeviceCode", value = "筛选条件 : where CollectDeviceModel.iotDeviceCode like #{_like_iotDeviceCode}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "_like_gasUserName", value = "筛选条件 : where CollectDeviceModel.gasUserName like #{_like_gasUserName}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "_like_gasUserCode", value = "筛选条件 : where CollectDeviceModel.gasUserCode like #{_like_gasUserCode}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "_like_gasUserAddress", value = "筛选条件 : where CollectDeviceModel.gasUserAddress like #{_like_gasUserAddress}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "_greaterthanorequal_createTime", value = "筛选条件 : where CollectDeviceModel.createTime >= #{_greaterthanorequal_createTime}",required = false, dataType = "long", paramType = "query"),
            @ApiImplicitParam(name = "_lessthan_createTime", value = "筛选条件 : where CollectDeviceModel.createTime < #{_lessthan_createTime}",required = false, dataType = "long", paramType = "query"),
            @ApiImplicitParam(name = "_equal_gasUserId", value = "筛选条件 : where CollectDeviceModel.gasUserId = #{_equal_gasUserId}",required = false, dataType = "long", paramType = "query"),
            @ApiImplicitParam(name = "_equal_gasUserCode", value = "筛选条件 : where CollectDeviceModel.gasUserCode = #{_equal_gasUserCode}",required = false, dataType = "string", paramType = "query"),

    })
    //endregion
    //region 请求 : get2
    @RequestMapping(value = "/v2/collect-devices", method = RequestMethod.GET)
    //endregion
    public CollectDeviceGetModel get2(Map<String, String> header, Map<String, Object> query) throws ServiceException {
        /* 查询采集设备 */
        //生成查询模型
        CollectDeviceCustomQueryModel queryModel = collectDeviceCustomConvertor.collectDeviceService_query2queryModel(query);
        Boolean showGasConsume = HzhrTypeUtil.object2boolean(query.get("_show_gasConsume"));
        if (showGasConsume != null && showGasConsume) {
            queryModel.setShow_gasConsume(true);
        }
        queryModel.setEqual_isValid(CommonOptions.YES_NO.YES);
        //查询实体
        List<CollectDeviceEntityExt> extList = null;
        String show = HzhrTypeUtil.object2string(query.get("_show"));
        if (!StringUtils.isEmpty(show)) {
            extList = collectDeviceDao.selectExtList1(queryModel);
        }
        //查询数量
        Integer total = null;
        Boolean showTotal = HzhrTypeUtil.object2boolean(query.get("_show_total"));
        if (showTotal != null && showTotal) {
            total = collectDeviceDao.selectCount(queryModel);
        }

        /* 返回信息 */
        CollectDeviceGetModel result = collectDeviceCustomConvertor.extList2collectDeviceGetModel(extList, total, null, query);
        //查询部门相关信息
        Boolean showDept = HzhrTypeUtil.object2boolean(query.get("_show_dept"));
        List<DeptModel> deptModels = null;
        if (showDept != null && showDept && extList != null) {
            List<Integer> deptIds = new ArrayList<>();
            for (CollectDeviceEntityExt ext : extList) {
                deptIds.add(ext.getDeptId());
            }

            Map<String, Object> query1 = new HashMap<>();
            query1.put("_in_id", deptIds);
            query1.put("_show", "list");
            query1.put("_show_managementName", true);
            query1.put("_show_subCompanyName", true);
            query1.put("_is_paging", false);
            deptModels = user_deptService.get(initHeader(header, AccessModeEnum.GLOBAL), query1).getModelList();
        }
        //在响应中添加额外信息
        List<CollectDeviceModel> collectDeviceModels = result.getModelList();
        if (collectDeviceModels != null) {
            for (int i = 0; i < collectDeviceModels.size(); i++) {
                CollectDeviceModel collectDeviceModel = collectDeviceModels.get(i);
                if (deptModels != null) {
                    for (DeptModel deptModel :
                            deptModels) {
                        if (collectDeviceModel.getDeptId().equals(deptModel.getId())) {
                            collectDeviceModel.setManagementName(deptModel.getManagementName());
                            collectDeviceModel.setSubCompanyName(deptModel.getSubCompanyName());
                        }
                    }
                }
            }
        }
        CollectDeviceModel collectDeviceModel = result.getModel();
        if (collectDeviceModel != null) {
            if (deptModels != null && deptModels.size() > 0) {
                DeptModel deptModel = deptModels.get(0);
                collectDeviceModel.setManagementName(deptModel.getManagementName());
                collectDeviceModel.setSubCompanyName(deptModel.getSubCompanyName());
            }
        }
        return result;
    }

}

